/**
 * 统一管理平台会员员用户相关的接口
*/
import { requestHttp } from "@/utils/requestHttp.ts";
//引入数据类型约束
import { member } from "./type";


//分页查询平台会员用户信息接口
export const reqMemberList = (page:number, pageSize:number) => {
    return requestHttp<member[]>({
        url:"/manage/member",
        method:"get",
        params:{
            page,
            pageSize
        }
    })
}


//平台会员用户信息修改接口
export const reqUpdateMember = (memberInfo:member) => {
    return requestHttp({
        url:"/manage/member",
        method:"put",
        data:memberInfo
    })
}


//平台会员用户删除接口
export const reqDeleteMember = (userId:number) => {
    return requestHttp({
        url:"/manage/member",
        method:"delete",
        params:{
            userId:userId
        }
    })
}

//平台会员用户批量删除接口
export const reqDeleteMembers = (userIdList:number[]) => {
    return requestHttp({
        url:"/manage/members",
        method:"delete",
        data:userIdList
    })
}

//根据用户名模糊查询平台会员用户信息
export const reqMemberListByLikeUsername = (username:string) => {
    return requestHttp({
        url:"/manage/members",
        method:"get",
        params:{
            username:username
        }
    })
}

//平台会员用户添加接口(测试接口)
export const reqSaveMember = (userInfo:any) => {
    return requestHttp({
        url:"/manage/member",
        method:"post",
        data:{
            id:userInfo.id,
            username:userInfo.username,
            password:userInfo.password,
            nickname:userInfo.nickname,
            email:userInfo.email,
            phone:userInfo.phone,
            avatar:userInfo.avatar
        }
    })
}
